<?php 
namespace App\Infra;

use App\Utils\ModelSDK\ModelOperator;
use App\Models\WeChatUser;
use App\Models\WeChatUserInfo;
use App\Models\GiRecord;
use App\Models\Weight;

class UserManage{

	use ModelOperator;

	public function getUsers($conditions){
		return $this->findModel(WeChatUser::class,WeChatUser::query()->with(['wechatUserInfo']),$conditions,$first= true);
	}

	public function getUser($conditions){
		return $this->findModel(WeChatUser::class,WeChatUser::query()->with(['wechatUserInfo']),$conditions,$first= false);
	}

	public function getUserByGiRecord($conditions){

		// dd($conditions);
		
		return $this->findModel(GiRecord::class,GiRecord::query()->orderBy('created_at','DESC'),$conditions,$first= true);
	}

	public function getUserByWeight($conditions){

		return $this->findModel(Weight::class,Weight::query()->orderBy('created_at','DESC'),$conditions,$first= true);
	}
}